<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>peach.nn.mem</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="peach-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="peach-module.html">Package&nbsp;peach</a> ::
        <a href="peach.nn-module.html">Package&nbsp;nn</a> ::
        Module&nbsp;mem
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="peach.nn.mem-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="peach.nn.mem-module.html">Module peach.nn.mem</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">################################################################################</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># Peach - Computational Intelligence for Python</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"># Jose Alexandre Nalon</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"># This file: nn/mem.py</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"># Associative memories and Hopfield models</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment">################################################################################</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"># Doc string, reStructuredText formatted:</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable peach.__doc__=peach-module.html#__doc__,Variable peach.fuzzy.__doc__=peach.fuzzy-module.html#__doc__,Variable peach.fuzzy.base.__doc__=peach.fuzzy.base-module.html#__doc__,Variable peach.fuzzy.cmeans.__doc__=peach.fuzzy.cmeans-module.html#__doc__,Variable peach.fuzzy.control.__doc__=peach.fuzzy.control-module.html#__doc__,Variable peach.fuzzy.defuzzy.__doc__=peach.fuzzy.defuzzy-module.html#__doc__,Variable peach.fuzzy.mf.__doc__=peach.fuzzy.mf-module.html#__doc__,Variable peach.fuzzy.norms.__doc__=peach.fuzzy.norms-module.html#__doc__,Variable peach.ga.__doc__=peach.ga-module.html#__doc__,Variable peach.ga.base.__doc__=peach.ga.base-module.html#__doc__,Variable peach.ga.chromosome.__doc__=peach.ga.chromosome-module.html#__doc__,Variable peach.ga.crossover.__doc__=peach.ga.crossover-module.html#__doc__,Variable peach.ga.fitness.__doc__=peach.ga.fitness-module.html#__doc__,Variable peach.ga.mutation.__doc__=peach.ga.mutation-module.html#__doc__,Variable peach.ga.selection.__doc__=peach.ga.selection-module.html#__doc__,Variable peach.nn.__doc__=peach.nn-module.html#__doc__,Variable peach.nn.af.__doc__=peach.nn.af-module.html#__doc__,Variable peach.nn.base.__doc__=peach.nn.base-module.html#__doc__,Variable peach.nn.kmeans.__doc__=peach.nn.kmeans-module.html#__doc__,Variable peach.nn.lrules.__doc__=peach.nn.lrules-module.html#__doc__,Variable peach.nn.mem.__doc__=peach.nn.mem-module.html#__doc__,Variable peach.nn.nnet.__doc__=peach.nn.nnet-module.html#__doc__,Variable peach.nn.rbfn.__doc__=peach.nn.rbfn-module.html#__doc__,Variable peach.optm.__doc__=peach.optm-module.html#__doc__,Variable peach.optm.base.__doc__=peach.optm.base-module.html#__doc__,Variable peach.optm.linear.__doc__=peach.optm.linear-module.html#__doc__,Variable peach.optm.multivar.__doc__=peach.optm.multivar-module.html#__doc__,Variable peach.optm.quasinewton.__doc__=peach.optm.quasinewton-module.html#__doc__,Variable peach.optm.stochastic.__doc__=peach.optm.stochastic-module.html#__doc__,Variable peach.pso.__doc__=peach.pso-module.html#__doc__,Variable peach.pso.acc.__doc__=peach.pso.acc-module.html#__doc__,Variable peach.pso.base.__doc__=peach.pso.base-module.html#__doc__,Variable peach.sa.__doc__=peach.sa-module.html#__doc__,Variable peach.sa.base.__doc__=peach.sa.base-module.html#__doc__,Variable peach.sa.neighbor.__doc__=peach.sa.neighbor-module.html#__doc__"><a title="peach.__doc__
peach.fuzzy.__doc__
peach.fuzzy.base.__doc__
peach.fuzzy.cmeans.__doc__
peach.fuzzy.control.__doc__
peach.fuzzy.defuzzy.__doc__
peach.fuzzy.mf.__doc__
peach.fuzzy.norms.__doc__
peach.ga.__doc__
peach.ga.base.__doc__
peach.ga.chromosome.__doc__
peach.ga.crossover.__doc__
peach.ga.fitness.__doc__
peach.ga.mutation.__doc__
peach.ga.selection.__doc__
peach.nn.__doc__
peach.nn.af.__doc__
peach.nn.base.__doc__
peach.nn.kmeans.__doc__
peach.nn.lrules.__doc__
peach.nn.mem.__doc__
peach.nn.nnet.__doc__
peach.nn.rbfn.__doc__
peach.optm.__doc__
peach.optm.base.__doc__
peach.optm.linear.__doc__
peach.optm.multivar.__doc__
peach.optm.quasinewton.__doc__
peach.optm.stochastic.__doc__
peach.pso.__doc__
peach.pso.acc.__doc__
peach.pso.base.__doc__
peach.sa.__doc__
peach.sa.base.__doc__
peach.sa.neighbor.__doc__" class="py-name" href="#" onclick="return doclink('link-0', '__doc__', 'link-0');">__doc__</a></tt> <tt class="py-op">=</tt> <tt class="py-docstring">"""</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">Associative memories and Hopfield network model.</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-docstring">This sub-package implements associative memories. In associative memories,</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-docstring">information is recovered by supplying not an exact index (such as in their</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">usual counterparts), but supplying an index simmilar enough that the information</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">can be deduced from what is stored in its synaptic weights. There are a number</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">of different memories of this kind.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">The most common type is the Hopfield network. A Hopfield network is a recurrent</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">self-associative memory. Although there are real-valued versions of the network,</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">the binary type is more common. In it, patterns are recovered from an initial</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">estimate through an iterative process.</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-comment">################################################################################</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">import</tt> <tt class="py-name">zeros</tt><tt class="py-op">,</tt> <tt class="py-name">eye</tt><tt class="py-op">,</tt> <tt class="py-name">all</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">random</tt> <tt class="py-keyword">import</tt> <tt class="py-name">randrange</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Package peach=peach-module.html"><a title="peach" class="py-name" href="#" onclick="return doclink('link-1', 'peach', 'link-1');">peach</a></tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Package peach.nn=peach.nn-module.html"><a title="peach.nn" class="py-name" href="#" onclick="return doclink('link-2', 'nn', 'link-2');">nn</a></tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Module peach.fuzzy.base=peach.fuzzy.base-module.html,Module peach.ga.base=peach.ga.base-module.html,Module peach.nn.base=peach.nn.base-module.html,Module peach.optm.base=peach.optm.base-module.html,Module peach.pso.base=peach.pso.base-module.html,Module peach.sa.base=peach.sa.base-module.html"><a title="peach.fuzzy.base
peach.ga.base
peach.nn.base
peach.optm.base
peach.pso.base
peach.sa.base" class="py-name" href="#" onclick="return doclink('link-3', 'base', 'link-3');">base</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-4" class="py-name"><a title="peach" class="py-name" href="#" onclick="return doclink('link-4', 'peach', 'link-1');">peach</a></tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="peach.nn" class="py-name" href="#" onclick="return doclink('link-5', 'nn', 'link-2');">nn</a></tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Module peach.nn.af=peach.nn.af-module.html"><a title="peach.nn.af" class="py-name" href="#" onclick="return doclink('link-6', 'af', 'link-6');">af</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-comment">################################################################################</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-comment"># Classes</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-comment">################################################################################</tt> </tt>
<a name="Hopfield"></a><div id="Hopfield-def"><a name="L36"></a><tt class="py-lineno"> 36</tt> <a class="py-toggle" href="#" id="Hopfield-toggle" onclick="return toggle('Hopfield');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html">Hopfield</a><tt class="py-op">(</tt><tt class="py-base-class">Layer</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Hopfield-expanded"><a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">    <tt class="py-docstring">'''</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">    Hopfield neural network model</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">    A Hopfield network is a recurrent network of one layer of neurons. There</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">    output of every neuron is conected to the inputs of every other neuron, but</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">    not to itself. This kind of network is autoassociative, or content-based</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">    memory. That means that, given a noisy version of a pattern stored in it,</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">    the network is capable of, through an iterative algorithm, recover the</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">    original pattern, removing the noise. There is a limit in the quantity of</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">    patterns that can be stored without causing error, and if a pattern is</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">    stored, its negated form is also stored.</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-docstring">    This is the binary form of the Hopfield network, which is the most common</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-docstring">    form. It implements a ``Layer`` of neurons, without bias, and with the</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-docstring">    Signum as the activation function.</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-docstring">    '''</tt> </tt>
<a name="Hopfield.__init__"></a><div id="Hopfield.__init__-def"><a name="L53"></a><tt class="py-lineno"> 53</tt> <a class="py-toggle" href="#" id="Hopfield.__init__-toggle" onclick="return toggle('Hopfield.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">size</tt><tt class="py-op">,</tt> <tt class="py-param">phi</tt><tt class="py-op">=</tt><tt id="link-7" class="py-name" targets="Class peach.nn.af.Signum=peach.nn.af.Signum-class.html"><a title="peach.nn.af.Signum" class="py-name" href="#" onclick="return doclink('link-7', 'Signum', 'link-7');">Signum</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.__init__-expanded"><a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-docstring">        Initializes the Hopfield network.</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt class="py-docstring">        The Hopfield network is implemented as a layer of neurons.</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-docstring">        :Parameters:</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring">          size</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-docstring">            The number of neurons in the network. In a Hopfield network, the</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring">            number of neurons is also the number of inputs in each neuron, and</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring">            the dimensionality of the patterns to be stored and recovered.</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">          phi</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring">            The activation function. Traditionally, the Hopfield network uses</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-docstring">            the signum function as activation. This is the default value.</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt id="link-8" class="py-name" targets="Class peach.nn.base.Layer=peach.nn.base.Layer-class.html"><a title="peach.nn.base.Layer" class="py-name" href="#" onclick="return doclink('link-8', 'Layer', 'link-8');">Layer</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Method peach.fuzzy.base.FuzzySet.__init__()=peach.fuzzy.base.FuzzySet-class.html#__init__,Method peach.fuzzy.cmeans.FuzzyCMeans.__init__()=peach.fuzzy.cmeans.FuzzyCMeans-class.html#__init__,Method peach.fuzzy.control.Controller.__init__()=peach.fuzzy.control.Controller-class.html#__init__,Method peach.fuzzy.control.Parametric.__init__()=peach.fuzzy.control.Parametric-class.html#__init__,Method peach.fuzzy.mf.Bell.__init__()=peach.fuzzy.mf.Bell-class.html#__init__,Method peach.fuzzy.mf.DecreasingRamp.__init__()=peach.fuzzy.mf.DecreasingRamp-class.html#__init__,Method peach.fuzzy.mf.DecreasingSigmoid.__init__()=peach.fuzzy.mf.DecreasingSigmoid-class.html#__init__,Method peach.fuzzy.mf.Gaussian.__init__()=peach.fuzzy.mf.Gaussian-class.html#__init__,Method peach.fuzzy.mf.IncreasingRamp.__init__()=peach.fuzzy.mf.IncreasingRamp-class.html#__init__,Method peach.fuzzy.mf.IncreasingSigmoid.__init__()=peach.fuzzy.mf.IncreasingSigmoid-class.html#__init__,Method peach.fuzzy.mf.Membership.__init__()=peach.fuzzy.mf.Membership-class.html#__init__,Method peach.fuzzy.mf.RaisedCosine.__init__()=peach.fuzzy.mf.RaisedCosine-class.html#__init__,Method peach.fuzzy.mf.Smf.__init__()=peach.fuzzy.mf.Smf-class.html#__init__,Method peach.fuzzy.mf.Trapezoid.__init__()=peach.fuzzy.mf.Trapezoid-class.html#__init__,Method peach.fuzzy.mf.Triangle.__init__()=peach.fuzzy.mf.Triangle-class.html#__init__,Method peach.fuzzy.mf.Zmf.__init__()=peach.fuzzy.mf.Zmf-class.html#__init__,Method peach.ga.base.GeneticAlgorithm.__init__()=peach.ga.base.GeneticAlgorithm-class.html#__init__,Method peach.ga.chromosome.Chromosome.__init__()=peach.ga.chromosome.Chromosome-class.html#__init__,Method peach.ga.crossover.OnePoint.__init__()=peach.ga.crossover.OnePoint-class.html#__init__,Method peach.ga.crossover.TwoPoint.__init__()=peach.ga.crossover.TwoPoint-class.html#__init__,Method peach.ga.crossover.Uniform.__init__()=peach.ga.crossover.Uniform-class.html#__init__,Method peach.ga.fitness.Fitness.__init__()=peach.ga.fitness.Fitness-class.html#__init__,Method peach.ga.fitness.Ranking.__init__()=peach.ga.fitness.Ranking-class.html#__init__,Method peach.ga.mutation.BitToBit.__init__()=peach.ga.mutation.BitToBit-class.html#__init__,Method peach.nn.af.Activation.__init__()=peach.nn.af.Activation-class.html#__init__,Method peach.nn.af.ArcTan.__init__()=peach.nn.af.ArcTan-class.html#__init__,Method peach.nn.af.Gaussian.__init__()=peach.nn.af.Gaussian-class.html#__init__,Method peach.nn.af.Linear.__init__()=peach.nn.af.Linear-class.html#__init__,Method peach.nn.af.Ramp.__init__()=peach.nn.af.Ramp-class.html#__init__,Method peach.nn.af.Sigmoid.__init__()=peach.nn.af.Sigmoid-class.html#__init__,Method peach.nn.af.Signum.__init__()=peach.nn.af.Signum-class.html#__init__,Method peach.nn.af.TanH.__init__()=peach.nn.af.TanH-class.html#__init__,Method peach.nn.af.Threshold.__init__()=peach.nn.af.Threshold-class.html#__init__,Method peach.nn.base.Layer.__init__()=peach.nn.base.Layer-class.html#__init__,Method peach.nn.kmeans.KMeans.__init__()=peach.nn.kmeans.KMeans-class.html#__init__,Method peach.nn.lrules.BackPropagation.__init__()=peach.nn.lrules.BackPropagation-class.html#__init__,Method peach.nn.lrules.Competitive.__init__()=peach.nn.lrules.Competitive-class.html#__init__,Method peach.nn.lrules.Cooperative.__init__()=peach.nn.lrules.Cooperative-class.html#__init__,Method peach.nn.lrules.LMS.__init__()=peach.nn.lrules.LMS-class.html#__init__,Method peach.nn.lrules.WinnerTakesAll.__init__()=peach.nn.lrules.WinnerTakesAll-class.html#__init__,Method peach.nn.mem.Hopfield.__init__()=peach.nn.mem.Hopfield-class.html#__init__,Method peach.nn.nnet.FeedForward.__init__()=peach.nn.nnet.FeedForward-class.html#__init__,Method peach.nn.nnet.GRNN.__init__()=peach.nn.nnet.GRNN-class.html#__init__,Method peach.nn.nnet.PNN.__init__()=peach.nn.nnet.PNN-class.html#__init__,Method peach.nn.nnet.SOM.__init__()=peach.nn.nnet.SOM-class.html#__init__,Method peach.nn.rbfn.RBFN.__init__()=peach.nn.rbfn.RBFN-class.html#__init__,Method peach.optm.base.Optimizer.__init__()=peach.optm.base.Optimizer-class.html#__init__,Method peach.optm.linear.Direct1D.__init__()=peach.optm.linear.Direct1D-class.html#__init__,Method peach.optm.linear.Fibonacci.__init__()=peach.optm.linear.Fibonacci-class.html#__init__,Method peach.optm.linear.GoldenRule.__init__()=peach.optm.linear.GoldenRule-class.html#__init__,Method peach.optm.linear.Interpolation.__init__()=peach.optm.linear.Interpolation-class.html#__init__,Method peach.optm.multivar.Direct.__init__()=peach.optm.multivar.Direct-class.html#__init__,Method peach.optm.multivar.Gradient.__init__()=peach.optm.multivar.Gradient-class.html#__init__,Method peach.optm.multivar.MomentumGradient.__init__()=peach.optm.multivar.MomentumGradient-class.html#__init__,Method peach.optm.multivar.Newton.__init__()=peach.optm.multivar.Newton-class.html#__init__,Method peach.optm.quasinewton.BFGS.__init__()=peach.optm.quasinewton.BFGS-class.html#__init__,Method peach.optm.quasinewton.DFP.__init__()=peach.optm.quasinewton.DFP-class.html#__init__,Method peach.optm.quasinewton.SR1.__init__()=peach.optm.quasinewton.SR1-class.html#__init__,Method peach.optm.stochastic.CrossEntropy.__init__()=peach.optm.stochastic.CrossEntropy-class.html#__init__,Method peach.pso.acc.Accelerator.__init__()=peach.pso.acc.Accelerator-class.html#__init__,Method peach.pso.acc.StandardPSO.__init__()=peach.pso.acc.StandardPSO-class.html#__init__,Method peach.pso.base.ParticleSwarmOptimizer.__init__()=peach.pso.base.ParticleSwarmOptimizer-class.html#__init__,Method peach.sa.base.BinarySA.__init__()=peach.sa.base.BinarySA-class.html#__init__,Method peach.sa.base.ContinuousSA.__init__()=peach.sa.base.ContinuousSA-class.html#__init__,Method peach.sa.neighbor.BinaryNeighbor.__init__()=peach.sa.neighbor.BinaryNeighbor-class.html#__init__,Method peach.sa.neighbor.ContinuousNeighbor.__init__()=peach.sa.neighbor.ContinuousNeighbor-class.html#__init__,Method peach.sa.neighbor.GaussianNeighbor.__init__()=peach.sa.neighbor.GaussianNeighbor-class.html#__init__,Method peach.sa.neighbor.InvertBitsNeighbor.__init__()=peach.sa.neighbor.InvertBitsNeighbor-class.html#__init__,Method peach.sa.neighbor.UniformNeighbor.__init__()=peach.sa.neighbor.UniformNeighbor-class.html#__init__"><a title="peach.fuzzy.base.FuzzySet.__init__
peach.fuzzy.cmeans.FuzzyCMeans.__init__
peach.fuzzy.control.Controller.__init__
peach.fuzzy.control.Parametric.__init__
peach.fuzzy.mf.Bell.__init__
peach.fuzzy.mf.DecreasingRamp.__init__
peach.fuzzy.mf.DecreasingSigmoid.__init__
peach.fuzzy.mf.Gaussian.__init__
peach.fuzzy.mf.IncreasingRamp.__init__
peach.fuzzy.mf.IncreasingSigmoid.__init__
peach.fuzzy.mf.Membership.__init__
peach.fuzzy.mf.RaisedCosine.__init__
peach.fuzzy.mf.Smf.__init__
peach.fuzzy.mf.Trapezoid.__init__
peach.fuzzy.mf.Triangle.__init__
peach.fuzzy.mf.Zmf.__init__
peach.ga.base.GeneticAlgorithm.__init__
peach.ga.chromosome.Chromosome.__init__
peach.ga.crossover.OnePoint.__init__
peach.ga.crossover.TwoPoint.__init__
peach.ga.crossover.Uniform.__init__
peach.ga.fitness.Fitness.__init__
peach.ga.fitness.Ranking.__init__
peach.ga.mutation.BitToBit.__init__
peach.nn.af.Activation.__init__
peach.nn.af.ArcTan.__init__
peach.nn.af.Gaussian.__init__
peach.nn.af.Linear.__init__
peach.nn.af.Ramp.__init__
peach.nn.af.Sigmoid.__init__
peach.nn.af.Signum.__init__
peach.nn.af.TanH.__init__
peach.nn.af.Threshold.__init__
peach.nn.base.Layer.__init__
peach.nn.kmeans.KMeans.__init__
peach.nn.lrules.BackPropagation.__init__
peach.nn.lrules.Competitive.__init__
peach.nn.lrules.Cooperative.__init__
peach.nn.lrules.LMS.__init__
peach.nn.lrules.WinnerTakesAll.__init__
peach.nn.mem.Hopfield.__init__
peach.nn.nnet.FeedForward.__init__
peach.nn.nnet.GRNN.__init__
peach.nn.nnet.PNN.__init__
peach.nn.nnet.SOM.__init__
peach.nn.rbfn.RBFN.__init__
peach.optm.base.Optimizer.__init__
peach.optm.linear.Direct1D.__init__
peach.optm.linear.Fibonacci.__init__
peach.optm.linear.GoldenRule.__init__
peach.optm.linear.Interpolation.__init__
peach.optm.multivar.Direct.__init__
peach.optm.multivar.Gradient.__init__
peach.optm.multivar.MomentumGradient.__init__
peach.optm.multivar.Newton.__init__
peach.optm.quasinewton.BFGS.__init__
peach.optm.quasinewton.DFP.__init__
peach.optm.quasinewton.SR1.__init__
peach.optm.stochastic.CrossEntropy.__init__
peach.pso.acc.Accelerator.__init__
peach.pso.acc.StandardPSO.__init__
peach.pso.base.ParticleSwarmOptimizer.__init__
peach.sa.base.BinarySA.__init__
peach.sa.base.ContinuousSA.__init__
peach.sa.neighbor.BinaryNeighbor.__init__
peach.sa.neighbor.ContinuousNeighbor.__init__
peach.sa.neighbor.GaussianNeighbor.__init__
peach.sa.neighbor.InvertBitsNeighbor.__init__
peach.sa.neighbor.UniformNeighbor.__init__" class="py-name" href="#" onclick="return doclink('link-9', '__init__', 'link-9');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt id="link-10" class="py-name" targets="Variable peach.ga.chromosome.Chromosome.size=peach.ga.chromosome.Chromosome-class.html#size,Variable peach.nn.base.Layer.size=peach.nn.base.Layer-class.html#size"><a title="peach.ga.chromosome.Chromosome.size
peach.nn.base.Layer.size" class="py-name" href="#" onclick="return doclink('link-10', 'size', 'link-10');">size</a></tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-11" class="py-name" targets="Variable peach.nn.base.Layer.phi=peach.nn.base.Layer-class.html#phi,Variable peach.nn.nnet.FeedForward.phi=peach.nn.nnet.FeedForward-class.html#phi,Variable peach.nn.rbfn.RBFN.phi=peach.nn.rbfn.RBFN-class.html#phi"><a title="peach.nn.base.Layer.phi
peach.nn.nnet.FeedForward.phi
peach.nn.rbfn.RBFN.phi" class="py-name" href="#" onclick="return doclink('link-11', 'phi', 'link-11');">phi</a></tt><tt class="py-op">=</tt><tt id="link-12" class="py-name"><a title="peach.nn.af.Signum" class="py-name" href="#" onclick="return doclink('link-12', 'Signum', 'link-7');">Signum</a></tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name" targets="Variable peach.nn.base.Layer.bias=peach.nn.base.Layer-class.html#bias,Variable peach.nn.nnet.FeedForward.bias=peach.nn.nnet.FeedForward-class.html#bias"><a title="peach.nn.base.Layer.bias
peach.nn.nnet.FeedForward.bias" class="py-name" href="#" onclick="return doclink('link-13', 'bias', 'link-13');">bias</a></tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__size</tt> <tt class="py-op">=</tt> <tt id="link-14" class="py-name"><a title="peach.ga.chromosome.Chromosome.size
peach.nn.base.Layer.size" class="py-name" href="#" onclick="return doclink('link-14', 'size', 'link-10');">size</a></tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__weights</tt> <tt class="py-op">=</tt> <tt class="py-name">zeros</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt id="link-15" class="py-name"><a title="peach.ga.chromosome.Chromosome.size
peach.nn.base.Layer.size" class="py-name" href="#" onclick="return doclink('link-15', 'size', 'link-10');">size</a></tt><tt class="py-op">,</tt> <tt id="link-16" class="py-name"><a title="peach.ga.chromosome.Chromosome.size
peach.nn.base.Layer.size" class="py-name" href="#" onclick="return doclink('link-16', 'size', 'link-10');">size</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"> </tt>
<a name="Hopfield.__getinputs"></a><div id="Hopfield.__getinputs-def"><a name="L73"></a><tt class="py-lineno"> 73</tt> <a class="py-toggle" href="#" id="Hopfield.__getinputs-toggle" onclick="return toggle('Hopfield.__getinputs');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#__getinputs">__getinputs</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.__getinputs-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.__getinputs-expanded"><a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__size</tt> </tt>
</div><a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">    <tt id="link-17" class="py-name" targets="Variable peach.nn.base.Layer.inputs=peach.nn.base.Layer-class.html#inputs,Variable peach.nn.mem.Hopfield.inputs=peach.nn.mem.Hopfield-class.html#inputs"><a title="peach.nn.base.Layer.inputs
peach.nn.mem.Hopfield.inputs" class="py-name" href="#" onclick="return doclink('link-17', 'inputs', 'link-17');">inputs</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-18" class="py-name" targets="Method peach.nn.base.Layer.__getinputs()=peach.nn.base.Layer-class.html#__getinputs,Method peach.nn.mem.Hopfield.__getinputs()=peach.nn.mem.Hopfield-class.html#__getinputs"><a title="peach.nn.base.Layer.__getinputs
peach.nn.mem.Hopfield.__getinputs" class="py-name" href="#" onclick="return doclink('link-18', '__getinputs', 'link-18');">__getinputs</a></tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">    <tt class="py-string">'''Number of inputs for each neuron in the layer. For a Hopfield model,</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-string">       there are as much inputs as there are neurons. Not writable.'''</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"> </tt>
<a name="Hopfield.__getweights"></a><div id="Hopfield.__getweights-def"><a name="L80"></a><tt class="py-lineno"> 80</tt> <a class="py-toggle" href="#" id="Hopfield.__getweights-toggle" onclick="return toggle('Hopfield.__getweights');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#__getweights">__getweights</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.__getweights-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.__getweights-expanded"><a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__weights</tt> </tt>
</div><a name="Hopfield.__setweights"></a><div id="Hopfield.__setweights-def"><a name="L82"></a><tt class="py-lineno"> 82</tt> <a class="py-toggle" href="#" id="Hopfield.__setweights-toggle" onclick="return toggle('Hopfield.__setweights');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#__setweights">__setweights</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">m</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.__setweights-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.__setweights-expanded"><a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__weights</tt> <tt class="py-op">=</tt> <tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">reshape</tt><tt class="py-op">(</tt><tt class="py-name">m</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Variable peach.nn.base.Layer.weights=peach.nn.base.Layer-class.html#weights,Variable peach.nn.mem.Hopfield.weights=peach.nn.mem.Hopfield-class.html#weights,Variable peach.nn.rbfn.RBFN.weights=peach.nn.rbfn.RBFN-class.html#weights"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-19', 'weights', 'link-19');">weights</a></tt><tt class="py-op">.</tt><tt id="link-20" class="py-name" targets="Variable peach.nn.base.Layer.shape=peach.nn.base.Layer-class.html#shape"><a title="peach.nn.base.Layer.shape" class="py-name" href="#" onclick="return doclink('link-20', 'shape', 'link-20');">shape</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">    <tt id="link-21" class="py-name"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-21', 'weights', 'link-19');">weights</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-22" class="py-name" targets="Method peach.nn.base.Layer.__getweights()=peach.nn.base.Layer-class.html#__getweights,Method peach.nn.mem.Hopfield.__getweights()=peach.nn.mem.Hopfield-class.html#__getweights,Method peach.nn.rbfn.RBFN.__getweights()=peach.nn.rbfn.RBFN-class.html#__getweights"><a title="peach.nn.base.Layer.__getweights
peach.nn.mem.Hopfield.__getweights
peach.nn.rbfn.RBFN.__getweights" class="py-name" href="#" onclick="return doclink('link-22', '__getweights', 'link-22');">__getweights</a></tt><tt class="py-op">,</tt> <tt id="link-23" class="py-name" targets="Method peach.nn.base.Layer.__setweights()=peach.nn.base.Layer-class.html#__setweights,Method peach.nn.mem.Hopfield.__setweights()=peach.nn.mem.Hopfield-class.html#__setweights,Method peach.nn.rbfn.RBFN.__setweights()=peach.nn.rbfn.RBFN-class.html#__setweights"><a title="peach.nn.base.Layer.__setweights
peach.nn.mem.Hopfield.__setweights
peach.nn.rbfn.RBFN.__setweights" class="py-name" href="#" onclick="return doclink('link-23', '__setweights', 'link-23');">__setweights</a></tt><tt class="py-op">)</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">    <tt class="py-string">'''A ``numpy`` array containing the synaptic weights of the network. Each</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-string">    line is the weight vector of a neuron. It is writable, but the new weight</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-string">    array must be the same shape of the neuron, or an exception is raised.'''</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"> </tt>
<a name="Hopfield.learn"></a><div id="Hopfield.learn-def"><a name="L90"></a><tt class="py-lineno"> 90</tt> <a class="py-toggle" href="#" id="Hopfield.learn-toggle" onclick="return toggle('Hopfield.learn');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#learn">learn</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">x</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.learn-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.learn-expanded"><a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"><tt class="py-docstring">        Applies one example of the training set to the network.</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">        Training a Hopfield network is not exactly an iterative procedure. The</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"><tt class="py-docstring">        network usually stores a small number of patterns, and the learning</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"><tt class="py-docstring">        procedure consists only in computing the synaptic weight matrix, which</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line"><tt class="py-docstring">        can be done in very few steps (in fact, just the number of patterns).</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line"><tt class="py-docstring">        This method is here for consistency with the rest of the library, but</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line"><tt class="py-docstring">        it works, anyway.</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"><tt class="py-docstring">        :Parameters:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"><tt class="py-docstring">          x</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-docstring">            The pattern to be stored. It must be a vector with the same size as</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"><tt class="py-docstring">            the network, or else an exception will be raised. The pattern can be</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line"><tt class="py-docstring">            of any dimensionality, but it will internally be converted to a</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line"><tt class="py-docstring">            column vector.</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-name">n</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="peach.ga.chromosome.Chromosome.size
peach.nn.base.Layer.size" class="py-name" href="#" onclick="return doclink('link-24', 'size', 'link-10');">size</a></tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-name">n</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt id="link-25" class="py-name" targets="Variable peach.fuzzy.cmeans.FuzzyCMeans.x=peach.fuzzy.cmeans.FuzzyCMeans-class.html#x,Variable peach.optm.linear.Direct1D.x=peach.optm.linear.Direct1D-class.html#x,Variable peach.optm.linear.GoldenRule.x=peach.optm.linear.GoldenRule-class.html#x,Variable peach.optm.linear.Interpolation.x=peach.optm.linear.Interpolation-class.html#x,Variable peach.optm.multivar.Direct.x=peach.optm.multivar.Direct-class.html#x,Variable peach.optm.multivar.Gradient.x=peach.optm.multivar.Gradient-class.html#x,Variable peach.optm.multivar.MomentumGradient.x=peach.optm.multivar.MomentumGradient-class.html#x,Variable peach.optm.multivar.Newton.x=peach.optm.multivar.Newton-class.html#x,Variable peach.optm.quasinewton.DFP.x=peach.optm.quasinewton.DFP-class.html#x,Variable peach.optm.quasinewton.SR1.x=peach.optm.quasinewton.SR1-class.html#x,Variable peach.sa.base.BinarySA.x=peach.sa.base.BinarySA-class.html#x,Variable peach.sa.base.ContinuousSA.x=peach.sa.base.ContinuousSA-class.html#x"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-25', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">        <tt id="link-26" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-26', 'x', 'link-25');">x</a></tt> <tt class="py-op">=</tt> <tt class="py-name">array</tt><tt class="py-op">(</tt><tt id="link-27" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-27', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">reshape</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-name">n</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-28', 'weights', 'link-19');">weights</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-29', 'weights', 'link-19');">weights</a></tt> <tt class="py-op">+</tt> <tt class="py-number">1.</tt><tt class="py-op">/</tt><tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">n</tt><tt class="py-op">)</tt> <tt class="py-op">*</tt> <tt class="py-name">dot</tt><tt class="py-op">(</tt><tt id="link-30" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-30', 'x', 'link-25');">x</a></tt><tt class="py-op">.</tt><tt class="py-name">T</tt><tt class="py-op">,</tt> <tt id="link-31" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-31', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-32', 'weights', 'link-19');">weights</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-33', 'weights', 'link-19');">weights</a></tt> <tt class="py-op">*</tt> <tt class="py-op">(</tt><tt class="py-number">1</tt> <tt class="py-op">-</tt> <tt class="py-name">eye</tt><tt class="py-op">(</tt><tt class="py-name">n</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line"> </tt>
<a name="Hopfield.train"></a><div id="Hopfield.train-def"><a name="L115"></a><tt class="py-lineno">115</tt> <a class="py-toggle" href="#" id="Hopfield.train-toggle" onclick="return toggle('Hopfield.train');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#train">train</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">train_set</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.train-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.train-expanded"><a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-docstring">        Presents a training set to the network</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"><tt class="py-docstring">        This method stores all the patterns of the training set in the weight</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"><tt class="py-docstring">        matrix. It calls the ``learn`` method for every pattern in the set.</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line"><tt class="py-docstring">        :Parameters:</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line"><tt class="py-docstring">          train_set</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line"><tt class="py-docstring">            A list containing all the patterns to be stored in the network. Each</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line"><tt class="py-docstring">            pattern is a vector of any dimensions, which are converted</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line"><tt class="py-docstring">            internally to a column vector.</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt id="link-34" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-34', 'x', 'link-25');">x</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">train_set</tt><tt class="py-op">:</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-35" class="py-name" targets="Method peach.nn.mem.Hopfield.learn()=peach.nn.mem.Hopfield-class.html#learn,Method peach.nn.nnet.FeedForward.learn()=peach.nn.nnet.FeedForward-class.html#learn,Method peach.nn.nnet.SOM.learn()=peach.nn.nnet.SOM-class.html#learn,Method peach.nn.rbfn.RBFN.learn()=peach.nn.rbfn.RBFN-class.html#learn"><a title="peach.nn.mem.Hopfield.learn
peach.nn.nnet.FeedForward.learn
peach.nn.nnet.SOM.learn
peach.nn.rbfn.RBFN.learn" class="py-name" href="#" onclick="return doclink('link-35', 'learn', 'link-35');">learn</a></tt><tt class="py-op">(</tt><tt id="link-36" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-36', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line"> </tt>
<a name="Hopfield.step"></a><div id="Hopfield.step-def"><a name="L132"></a><tt class="py-lineno">132</tt> <a class="py-toggle" href="#" id="Hopfield.step-toggle" onclick="return toggle('Hopfield.step');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#step">step</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">x</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.step-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.step-expanded"><a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"><tt class="py-docstring">        Performs a step in the recovering procedure</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line"><tt class="py-docstring">        The algorithm for recovering the patterns stored in a Hopfield network</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line"><tt class="py-docstring">        is an iterative algorithm which goes from a starting test pattern (a</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"><tt class="py-docstring">        stored pattern with noise) and recovers the noiseless version -- if</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"><tt class="py-docstring">        possible. This method takes the test pattern and performs one step of</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"><tt class="py-docstring">        the convergence</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"><tt class="py-docstring">        :Parameters:</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line"><tt class="py-docstring">          x</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-docstring">            The noisy pattern.</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"><tt class="py-docstring">        :Returns:</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"><tt class="py-docstring">          The result of one step of the convergence. This might be the same as</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"><tt class="py-docstring">          the input pattern, or the pattern with one component inverted.</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">        <tt id="link-37" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-37', 'x', 'link-25');">x</a></tt> <tt class="py-op">=</tt> <tt class="py-name">reshape</tt><tt class="py-op">(</tt><tt id="link-38" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-38', 'x', 'link-25');">x</a></tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name"><a title="peach.nn.base.Layer.inputs
peach.nn.mem.Hopfield.inputs" class="py-name" href="#" onclick="return doclink('link-39', 'inputs', 'link-17');">inputs</a></tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">        <tt class="py-name">k</tt> <tt class="py-op">=</tt> <tt class="py-name">randrange</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="peach.ga.chromosome.Chromosome.size
peach.nn.base.Layer.size" class="py-name" href="#" onclick="return doclink('link-40', 'size', 'link-10');">size</a></tt><tt class="py-op">)</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">        <tt id="link-41" class="py-name" targets="Variable peach.fuzzy.control.Controller.y=peach.fuzzy.control.Controller-class.html#y,Variable peach.nn.base.Layer.y=peach.nn.base.Layer-class.html#y,Variable peach.nn.nnet.FeedForward.y=peach.nn.nnet.FeedForward-class.html#y,Variable peach.nn.nnet.SOM.y=peach.nn.nnet.SOM-class.html#y,Variable peach.nn.rbfn.RBFN.y=peach.nn.rbfn.RBFN-class.html#y"><a title="peach.fuzzy.control.Controller.y
peach.nn.base.Layer.y
peach.nn.nnet.FeedForward.y
peach.nn.nnet.SOM.y
peach.nn.rbfn.RBFN.y" class="py-name" href="#" onclick="return doclink('link-41', 'y', 'link-41');">y</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="peach.nn.base.Layer.phi
peach.nn.nnet.FeedForward.phi
peach.nn.rbfn.RBFN.phi" class="py-name" href="#" onclick="return doclink('link-42', 'phi', 'link-11');">phi</a></tt><tt class="py-op">(</tt><tt class="py-name">dot</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="peach.nn.base.Layer.weights
peach.nn.mem.Hopfield.weights
peach.nn.rbfn.RBFN.weights" class="py-name" href="#" onclick="return doclink('link-43', 'weights', 'link-19');">weights</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt id="link-44" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-44', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-45" class="py-name"><a title="peach.fuzzy.control.Controller.y
peach.nn.base.Layer.y
peach.nn.nnet.FeedForward.y
peach.nn.nnet.SOM.y
peach.nn.rbfn.RBFN.y" class="py-name" href="#" onclick="return doclink('link-45', 'y', 'link-41');">y</a></tt> <tt class="py-op">!=</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">            <tt id="link-46" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-46', 'x', 'link-25');">x</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-47" class="py-name"><a title="peach.fuzzy.control.Controller.y
peach.nn.base.Layer.y
peach.nn.nnet.FeedForward.y
peach.nn.nnet.SOM.y
peach.nn.rbfn.RBFN.y" class="py-name" href="#" onclick="return doclink('link-47', 'y', 'link-41');">y</a></tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-48" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-48', 'x', 'link-25');">x</a></tt> </tt>
</div><a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line"> </tt>
<a name="Hopfield.__call__"></a><div id="Hopfield.__call__-def"><a name="L158"></a><tt class="py-lineno">158</tt> <a class="py-toggle" href="#" id="Hopfield.__call__-toggle" onclick="return toggle('Hopfield.__call__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="peach.nn.mem.Hopfield-class.html#__call__">__call__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">x</tt><tt class="py-op">,</tt> <tt class="py-param">imax</tt><tt class="py-op">=</tt><tt class="py-number">2000</tt><tt class="py-op">,</tt> <tt class="py-param">eqmax</tt><tt class="py-op">=</tt><tt class="py-number">100</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Hopfield.__call__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Hopfield.__call__-expanded"><a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"><tt class="py-docstring">        Recovers a stored pattern</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line"><tt class="py-docstring">        The ``__call__`` interface should be called if a memory needs to be</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line"><tt class="py-docstring">        recovered from the network. Given a noisy pattern ``x``, the algorithm</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"><tt class="py-docstring">        will be executed until convergence or a maximum number of iterations</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"><tt class="py-docstring">        occur. This method repeatedly calls the ``step`` method until a stop</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-docstring">        condition is reached. The stop condition is the maximum number of</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"><tt class="py-docstring">        iterations, or a number of iterations where no changes are found in the</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line"><tt class="py-docstring">        retrieved pattern.</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line"><tt class="py-docstring">        :Parameters:</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line"><tt class="py-docstring">          x</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"><tt class="py-docstring">            The noisy pattern vector presented to the network.</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line"><tt class="py-docstring">          imax</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line"><tt class="py-docstring">            The maximum number of iterations the algorithm is to be repeated.</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line"><tt class="py-docstring">            When this number of iterations is reached, the algorithm will stop,</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"><tt class="py-docstring">            whether the pattern was found or not. Defaults to 2000.</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line"><tt class="py-docstring">          eqmax</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line"><tt class="py-docstring">            The maximum number of iterations the algorithm will be repeated if</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"><tt class="py-docstring">            no changes occur in the retrieval of the pattern. At each iteration</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-docstring">            of the algorithm, a component might change. It is considered that,</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line"><tt class="py-docstring">            if a number of iterations are performed and no changes are found in</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"><tt class="py-docstring">            the pattern, then the algorithm converged, and it stops. Defaults to</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"><tt class="py-docstring">            100.</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"><tt class="py-docstring">        :Returns:</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"><tt class="py-docstring">          The vector containing the recovered pattern from the stored memories.</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">        <tt class="py-name">eq</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt class="py-name">imax</tt> <tt class="py-keyword">and</tt> <tt class="py-name">eq</tt> <tt class="py-op">&lt;</tt> <tt class="py-name">eqmax</tt><tt class="py-op">:</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">            <tt class="py-name">xnew</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name" targets="Method peach.fuzzy.cmeans.FuzzyCMeans.step()=peach.fuzzy.cmeans.FuzzyCMeans-class.html#step,Method peach.ga.base.GeneticAlgorithm.step()=peach.ga.base.GeneticAlgorithm-class.html#step,Method peach.nn.kmeans.KMeans.step()=peach.nn.kmeans.KMeans-class.html#step,Method peach.nn.mem.Hopfield.step()=peach.nn.mem.Hopfield-class.html#step,Method peach.optm.base.Optimizer.step()=peach.optm.base.Optimizer-class.html#step,Method peach.optm.linear.Direct1D.step()=peach.optm.linear.Direct1D-class.html#step,Method peach.optm.linear.Fibonacci.step()=peach.optm.linear.Fibonacci-class.html#step,Method peach.optm.linear.GoldenRule.step()=peach.optm.linear.GoldenRule-class.html#step,Method peach.optm.linear.Interpolation.step()=peach.optm.linear.Interpolation-class.html#step,Method peach.optm.multivar.Direct.step()=peach.optm.multivar.Direct-class.html#step,Method peach.optm.multivar.Gradient.step()=peach.optm.multivar.Gradient-class.html#step,Method peach.optm.multivar.MomentumGradient.step()=peach.optm.multivar.MomentumGradient-class.html#step,Method peach.optm.multivar.Newton.step()=peach.optm.multivar.Newton-class.html#step,Method peach.optm.quasinewton.BFGS.step()=peach.optm.quasinewton.BFGS-class.html#step,Method peach.optm.quasinewton.DFP.step()=peach.optm.quasinewton.DFP-class.html#step,Method peach.optm.quasinewton.SR1.step()=peach.optm.quasinewton.SR1-class.html#step,Method peach.optm.stochastic.CrossEntropy.step()=peach.optm.stochastic.CrossEntropy-class.html#step,Method peach.pso.base.ParticleSwarmOptimizer.step()=peach.pso.base.ParticleSwarmOptimizer-class.html#step,Method peach.sa.base.BinarySA.step()=peach.sa.base.BinarySA-class.html#step,Method peach.sa.base.ContinuousSA.step()=peach.sa.base.ContinuousSA-class.html#step"><a title="peach.fuzzy.cmeans.FuzzyCMeans.step
peach.ga.base.GeneticAlgorithm.step
peach.nn.kmeans.KMeans.step
peach.nn.mem.Hopfield.step
peach.optm.base.Optimizer.step
peach.optm.linear.Direct1D.step
peach.optm.linear.Fibonacci.step
peach.optm.linear.GoldenRule.step
peach.optm.linear.Interpolation.step
peach.optm.multivar.Direct.step
peach.optm.multivar.Gradient.step
peach.optm.multivar.MomentumGradient.step
peach.optm.multivar.Newton.step
peach.optm.quasinewton.BFGS.step
peach.optm.quasinewton.DFP.step
peach.optm.quasinewton.SR1.step
peach.optm.stochastic.CrossEntropy.step
peach.pso.base.ParticleSwarmOptimizer.step
peach.sa.base.BinarySA.step
peach.sa.base.ContinuousSA.step" class="py-name" href="#" onclick="return doclink('link-49', 'step', 'link-49');">step</a></tt><tt class="py-op">(</tt><tt id="link-50" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-50', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">any</tt><tt class="py-op">(</tt><tt class="py-name">xnew</tt> <tt class="py-op">!=</tt> <tt id="link-51" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-51', 'x', 'link-25');">x</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">                <tt id="link-52" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-52', 'x', 'link-25');">x</a></tt> <tt class="py-op">=</tt> <tt class="py-name">xnew</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">                <tt class="py-name">eq</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-name">i</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">            <tt class="py-name">eq</tt> <tt class="py-op">=</tt> <tt class="py-name">eq</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-53" class="py-name"><a title="peach.fuzzy.cmeans.FuzzyCMeans.x
peach.optm.linear.Direct1D.x
peach.optm.linear.GoldenRule.x
peach.optm.linear.Interpolation.x
peach.optm.multivar.Direct.x
peach.optm.multivar.Gradient.x
peach.optm.multivar.MomentumGradient.x
peach.optm.multivar.Newton.x
peach.optm.quasinewton.DFP.x
peach.optm.quasinewton.SR1.x
peach.sa.base.BinarySA.x
peach.sa.base.ContinuousSA.x" class="py-name" href="#" onclick="return doclink('link-53', 'x', 'link-25');">x</a></tt> </tt>
</div></div><a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line"> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line"> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"><tt class="py-comment">################################################################################</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line"><tt class="py-comment"># Test</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">"__main__"</tt><tt class="py-op">:</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="peach-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Jul 31 16:59:51 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
